const mongoose = require("mongoose");

const db = () => {
  mongoose
    .connect("mongodb://localhost:27017/node", {
      useNewUrlParser: true,
      useUnifiedTopology: true,
    })
    .then(() => {
      console.log("连接成功");
    })
    .catch(() => {
      console.log("连接失败");
    });
};

module.exports = db;
